const { sequelize, DataTypes } = require('../utill/getSequelize');
const { T_exam_label } = require('./t_exam_label');

const t_label_to_realLabel = sequelize.define('t_label_to_realLabel', {
    id: {
        type: DataTypes.INTEGER,
        primaryKey: true,
        autoIncrement: true,
    },

    target_id: {
        type: DataTypes.INTEGER,
    },

    label_id: {
        type: DataTypes.INTEGER
    },

    paper_type: {
        type: DataTypes.STRING
    }
});


t_label_to_realLabel.belongsTo(T_exam_label, {
    foreignKey: 'label_id',
    as: 'label'
});



//同步模型和数据库表
(async () => {
    try {
        await sequelize.sync({ force: false });
        console.log('All models were synchronized successfully.');
    } catch (error) {
        console.log(error);
    }

})();

//提供出去
module.exports = { t_label_to_realLabel };